const CellType = require('./CellType');
const Direction = require('./Direction');

const Cell = function(y, x, type) {
  this.x = x;
  this.y = y;
  this.type = type;
};

Cell.prototype.toString = function() {
  switch (this.type) {
    case CellType.ANIMAL:
    return ' ' + this.animal.category + this.animal.sequence + '  ';
    case CellType.WALL:
    return ' *** ';
    case CellType.PATH:
    return '     ';
    case CellType.PATH_BOTH:
    return ' ||==';
    case CellType.ROUTE:
    return ' ' + this.route.category + Direction.stringify(this.direction) + '  ';
    case CellType.ROUTE_HORIZONTAL:
    return ' ' + '||' + this.routeHorizontal.category + Direction.stringify(this.directionHorizontal);
    case CellType.ROUTE_VERTICAL:
    return ' ' + this.routeVertical.category + Direction.stringify(this.directionVertical) + '==';
    case CellType.ROUTE_BOTH:
    return ' ' + this.routeVertical.category +
      Direction.stringify(this.directionVertical) +
      this.routeHorizontal.category +
      Direction.stringify(this.directionHorizontal);
  }
};

module.exports = Cell;
